package com.example.myapplication.viewmodelsharedcommondata.vd3;

import androidx.lifecycle.MutableLiveData;

//  引擎
public class MyEngine {

    private static MyEngine myEngine;
    //  单列可以同时提供给所有  Activty  用共同的数据
    public static MyEngine getInstance(){
        if (myEngine == null) {
            synchronized (MyEngine.class) {
                if (myEngine == null) {
                    myEngine = new MyEngine();
                }
            }
        }
        return myEngine;
    }


    private MutableLiveData<String> data;
    //  暴露给其它类调用
    public MutableLiveData<String> getData() {
        if (data == null) {
            data = new MutableLiveData<>();
        }
        return data;
    }



}
